﻿namespace BEGDC.CC.Web.Common
{
    using System;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using BEGDC.CC.BL.Workflow;
    using BEGDC.CC.Web.UserControls;

    /// <summary>
    ///	Summary description for StampCtrl.
    /// </summary>
    public class StampCell : System.Web.UI.UserControl
    {
        public string stampActionStr = string.Empty;
        protected System.Web.UI.HtmlControls.HtmlTableCell stampCell;
        protected System.Web.UI.WebControls.Label stampTime;
        protected System.Web.UI.WebControls.Label stampActor;
        protected System.Web.UI.WebControls.Label stampAction;
        protected System.Web.UI.HtmlControls.HtmlImage imgStampCell;

        private void Page_Load(object sender, System.EventArgs e)
        {
            //Put user code to initialize the page here
        }

        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }

        /// <summary>
        ///	Required method for Designer support - do not modify
        ///	the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.Load += new System.EventHandler(this.Page_Load);

        }
        #endregion

        /// <summary>
        /// Set the font of StampCtrl
        /// </summary>
        /// <param name="requestName">Actor</param>
        /// <param name="time">ActionDate</param>
        /// <param name="actionName">ActionName</param>
        /// <param name="image">Image</param>
        public void SetStampInfo(string requestName, string time, string actionName, string image, Color color)
        {
            this.stampActor.Text = requestName.Contains("SSMEHeadApproval") ? requestName.Replace("SSMEHeadApproval", "IBGHeadApproval") : requestName;
            if (this.stampActor.Text.Contains("CostCenterHeadApproval")) this.stampActor.Text = "CostCenterHead \n Approval";
            this.stampTime.Text = time;
            this.stampAction.Text = actionName;
            this.stampAction.ForeColor = color;
            this.stampActionStr = actionName;
            //this.stampCell.Attributes["background"] = WebUtility.Path + "\\images\\" + image;
            this.imgStampCell.Src = WebUtility.Path + "\\images\\" + image;
        }
    }
}
